C:\users\default\JavaLessons>java MultiEcho < input.txt > output.txt D:\users\default\JavaLessons>
Input and output redirection can be used simultaneously. Here is an example run of the program:
C:\users\default\JavaLessons>java MultiEcho < input.txt > output.txt C:\users\default\JavaLessons>type output.txt Enter line1: You typed: This is line one, Enter line2: You typed: this is line two, Enter line3: You typed: this is line three, Enter line4: You typed: this is line, uh... four, Enter line5: You typed: and this is the last line.
The order on the command line does not matter:
C:\users\default\JavaLessons>java MultiEcho > output.txt < input.txt
You can have only one input file redirected to a program and one output file redirected from a program.